var str= window.location.href.split("?")[1].split("=")[1];
console.log(str);
var province=decodeURI(str).split("(")[1].split(")")[0];
console.log(province);
var div =document.getElementById("title");
div.innerHTML=province;
var div1 =document.getElementById("op");
div1.innerHTML=province;

var arr=["北京", "天津", "上海", "重庆", "新疆", "西藏", "宁夏", "内蒙古",
    "广西", "黑龙江", "吉林", "辽宁", "河北", "山东", "江苏", "安徽",
    "浙江", "福建", "广东", "海南", "云南", "贵州", "四川", "湖南",
    "湖北", "河南", "山西", "陕西", "甘肃", "青海", "江西", "台湾", "香港", "澳门"];

var d=document.getElementById("select")
for (var i=0;i<arr.length;i++){
    var a=new Option();
    a.value=arr[i];
    a.text=arr[i];
    d.options.add(a);
}

layui.use('form', function() {
    var form=layui.form;
    form.on('select(brickType)', function(data){
        var s=data.value;
        if(province!=s) {
            window.location.href = "/province_index.html?proince=encodeURI(" + s + ")";
        }
    });
});

/*function f(s){
    /!* console.log(2); *!/
    /!*var s=$("#select").find("option:selected").text();
*!/
    if(province!=s){
        console.log(s);
        window.location.href="/province_index.html?proince=encodeURI("+s+")";
    }
}*/
$(function () {
    //触发onclick事件 好显示出那个折线图
    $(".chooseBox").eq(0).click();
    $.ajax({
        type: "get",
        url: "/getHrefData",
        data:{"province":province},
        success: function(msg){
            var a=msg.toString().split(',');
            console.log(a);
            for (var i=0;i<8;i++)
            {
                /*alert( "Data Saved: " +a[i]  );*/
                $("#ProvinceCount"+i).html(a[i]);

            }


        }
    });

})

var div=document.getElementById('ProvinceCount2');
div.style.color="#476da0";
var div=document.getElementById('ProvinceCount5');
div.style.color="#e83132";
var div=document.getElementById('ProvinceCount6');
div.style.color="#10aeb5";
var div=document.getElementById('ProvinceCount7');
div.style.color="black";

/*time*/
var date=new Date;
var y=date.getFullYear();
var m=date.getMonth()+1;
var  mm=""+m;
if (m<= 9){
    mm=""+0+m;
}
var d=date.getDate();
var dd=""+d-1;
if (d<= 9){
    dd=""+0+d-1;
}

console.log(m);
var title2=document.getElementById("title2").innerText="新增数据统计周期为昨日"+mm+"."+dd+" 0-24时";
var title=document.getElementById("title1").innerText="数据更新至 "+y+"."+mm+"."+dd+" 0-24时";